#version 300 es
precision mediump float;

in vec2 tex_coord;
out vec4 frag_color;

uniform sampler2D y_texture;
uniform sampler2D u_texture;
uniform sampler2D v_texture;
uniform vec3 tex_color;

uniform mat3 yuv2rgb;

void main(void) {
  vec3 yuv;
  yuv.x = texture(y_texture, tex_coord).r;

  yuv.y = texture(u_texture, tex_coord).r - 0.5;
  yuv.z = texture(v_texture, tex_coord).r - 0.5;

  frag_color = vec4(yuv2rgb * yuv, 1.0f) * vec4(tex_color, 1.0f);
}